package com.jinhongone.pattern.creater.factory.config_simpleFactory;

public class LatteCoffee extends Coffee {

    private LatteCoffee() {
    }

    private static volatile LatteCoffee instance;

    public static LatteCoffee getInstance() {
//      懒汉-单例模式：双重检测锁
        if (instance == null) {
            synchronized (LatteCoffee.class) {
                if (instance == null) {
                    instance = new LatteCoffee();
                }
            }
        }
        return instance;
    }

    @Override
    public String getName() {
        return "拿铁coffee";
    }
}
